package com.shaozi.nc.mq.substance;

import org.apache.log4j.Logger;
import org.json.JSONObject;

import com.shaozi.data.mq.business.base.SourceTypeConsts.OA.Crm_Custom;
import com.shaozi.data.mq.business.bean.MQExchangeRuleBean;
import com.shaozi.data.mq.business.bean.MQPushItem;
import com.shaozi.data.mq.business.bus.substance.BasePushSubstanceHandler;
import com.shaozi.lib.throwable.SzException;
import com.shaozi.nc.mq.bean.crm.BeAddFollowUserBean;
import com.shaozi.nc.mq.bean.crm.CommentBean;
import com.shaozi.nc.mq.bean.crm.CustomDuplicateCheckingBean;
import com.shaozi.nc.mq.bean.crm.CustomUplimitBean;
import com.shaozi.nc.mq.bean.crm.CustomerHaveListBean;
import com.shaozi.nc.mq.bean.crm.FollowUpRecordBean;
import com.shaozi.nc.mq.bean.crm.ImportCustomerResultBean;
import com.shaozi.nc.mq.bean.crm.OpenSeeCustomerWillRecoverBean;
import com.shaozi.nc.mq.bean.crm.OpenSeeRuleChangeBean;
import com.shaozi.nc.mq.bean.crm.OpenSeeRuleDistributionBean;
import com.shaozi.nc.mq.bean.crm.ReplyBean;
import com.shaozi.nc.mq.bean.crm.TransCustomerBean;
import com.shaozi.nc.mq.bean.crm.custom.CrmCustomAlarmBean;
import com.shaozi.nc.mq.bean.crm.custom.CrmCustomSimpleDetailBean;

/**
 * 客服 crm 9500
 *
 */
public class CrmCustomPushSubstance extends BasePushSubstanceHandler {

	private final Logger logger = Logger.getLogger(CrmCustomPushSubstance.class);

	public CrmCustomPushSubstance() {

	}

	@Override
	protected void onExchangeBiz(MQExchangeRuleBean pushData, MQPushItem pushItem, JSONObject jsonObj)
			throws SzException {
		switch (pushItem.getSourceType()) {
		case Crm_Custom.Import_Customer_Result:
		case Crm_Custom.Import_Order_Result:
			exchangeBiz(pushData, jsonObj, ImportCustomerResultBean.class);
			break;
		case Crm_Custom.Trans_Customer:
			exchangeBiz(pushData, jsonObj, TransCustomerBean.class);
			break;
		case Crm_Custom.BeAdd_Follow_User:
			exchangeBiz(pushData, jsonObj, BeAddFollowUserBean.class);
			break;
		case Crm_Custom.OpenSee_Rule_Change:
			exchangeBiz(pushData, jsonObj, OpenSeeRuleChangeBean.class);
			break;
		case Crm_Custom.OpenSee_Customer_Will_Recover:
			exchangeBiz(pushData, jsonObj, OpenSeeCustomerWillRecoverBean.class);
			break;
		case Crm_Custom.Custom_Uplimit:
			exchangeBiz(pushData, jsonObj, CustomUplimitBean.class);
			break;
		case Crm_Custom.CustomDuplicateChecking:
			exchangeBiz(pushData, jsonObj, CustomDuplicateCheckingBean.class);
			break;
		case Crm_Custom.CustomUplimitRuleDelete:
			exchangeBiz(pushData, jsonObj, CustomUplimitBean.class);
			break;
		case Crm_Custom.CustomUplimitRuleUserDelete:
			exchangeBiz(pushData, jsonObj, CustomUplimitBean.class);
			break;
		case Crm_Custom.Comment:
			exchangeBiz(pushData, jsonObj, CommentBean.class);
			break;
		case Crm_Custom.Reply:
			exchangeBiz(pushData, jsonObj, ReplyBean.class);
			break;
		case Crm_Custom.Open_See_Rule_Distribution:
			exchangeBiz(pushData, jsonObj, OpenSeeRuleDistributionBean.class);
			break;
		case Crm_Custom.FOLLOW_UP_RECORD:
			exchangeBiz(pushData, jsonObj, FollowUpRecordBean.class);
			break;
		case Crm_Custom.CUSTOMER_HAVE_list:
			exchangeBiz(pushData, jsonObj, CustomerHaveListBean.class);
			break;
		case Crm_Custom.AddComment:
		case Crm_Custom.ReplyComment:
		case Crm_Custom.Created:
		case Crm_Custom.Status:
		case Crm_Custom.Principal:
		case Crm_Custom.Actor:
			exchangeBiz(pushData, jsonObj, CrmCustomSimpleDetailBean.class);
			break;
		case Crm_Custom.Alarm:
		case Crm_Custom.DeleteAlarm:
			exchangeBiz(pushData, jsonObj, CrmCustomAlarmBean.class);
			break;
		default:
			pushData.setBiz(null);
			break;
		}
	}
}
